package com.zoro.jianyue.ui.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.view.View;

import com.zoro.jianyue.ui.base.BaseLazyFragment;

import java.security.spec.PSSParameterSpec;
import java.util.List;

/**
 * Created by CM-ZR on 2016/1/21.
 */
public class VPFragmentAdapter extends FragmentPagerAdapter {
    List<BaseLazyFragment> mListFragments = null;

    public VPFragmentAdapter(FragmentManager fragmentManager, List<BaseLazyFragment> fragments) {
        super(fragmentManager);
        mListFragments = fragments;
    }

    @Override
    public int getCount() {
        return null != mListFragments ? mListFragments.size() : 0;
    }

    @Override
    public Fragment getItem(int position) {
        if (mListFragments != null && position > -1 && position < mListFragments.size()) {
            return mListFragments.get(position);
        }else {
            return null;
        }
    }
}
